#include<stdio.h>
  int main()
{
    float f;
    char ch;
    scanf("%f %c",&f,&ch);

    if((f<-273.15 && ch=='C') || (f<-459.67 && ch=='F'))
        printf("Invalid\n");
    else if(f>=-273.15 && ch=='C')
        printf("%.2f F\n",(f*1.8+32));
    else if(f>=-459.67 && ch=='F')
        printf("%.2f C\n",((f-32)/1.8));

    return 0;
    }

